class GetVillage
{
    /**
    * GetVillage get village matrix based on array of data
    *   We use php to make a dataset based on a xml matrix or a php array
    *    
    *   Landtypes:  Mountain, Swamp, Glacier, Plain, Forest
    *   
    *   Ultimately we'd use a pentagram to have these "grow" from the borders of each edge. But that will prolly be to difficult for now.
    *   We settle for a square grid that have plain in Glacier in the middle and the others from the corners.
    *    
    *   Buildings are: Houses, Workshops, Temples, Barracks, Forts, Barriers
    *   And lastly: Wilderness
    *    
    *   Algoritm:
    *   make a matrix, populate each cell with a land type based on what the mage got.
    *
    * @param   array [$landinfo] assoc array with keys Land, Houses, Workshops, Temples, Barracks, Forts, Barriers, Wilderness, Mountain, Swamp, Glacier, Plain, Forest
    * @return  array a matrix of 
    * @author  Olav Bringedal <olav@jaggu.org>
    * @since   Tue Feb 23 2010 12:21:31 GMT+0100
    * @version v 0.00 Tue Feb 23 2010 12:21:31 GMT+0100
    * @todo    lots
    */

    function GetVillage($landinfo)
    {
              
       $village= array();
       
       // Calculate height width of matrix
       
       //OBR 23/2-10 sqare for now
       $width=$height=sqr($landinfo['land']);
       
       // Start populate the matrix
       //   Mountain upper left
       //       if free: place
       //       else: got either down or right
       $startCoord['x']=0;
       $startCoord['y']=0;
       $move[1]=1;
       $move[2]=1;
       
       //   Swamp upper right
       //       if free: place
       //       else: got either down or left
       $startCoord['x']=$width;
       $startCoord['y']=0;
       $move[1]=1;
       $move[2]=-1;
       
       //   Forest lower left
       //       if free: place
       //       else: got either up or right
       $startCoord['x']=0;
       $startCoord['y']=$height;
       $move[1]=-1;
       $move[2]=1;
       
       //   plains lower right
       //       if free: place
       //       else: got either down or left
       $startCoord['x']=$width;
       $startCoord['y']=0;
       $move[1]=-1;
       $move[2]=-1;
       
       //   glacier middle
       //       if free: place
       //       else: got either down or left
       $startCoord['x']=$width/2;
       $startCoord['y']=$height/2;
       
       $move[1]=0;
       $move[2]=0;
       0:special case: go anywhere
       
    }
   
    /**
    *  placeLand put a land in village matrix based free or not and direction
    *    
    *  if free: place
    *  else: got either $move[0] or $move[1]
    *  if $move=0 go in any direction
    *   
    *
    * @param   array [$landinfo] assoc array with keys Land, Houses, Workshops, Temples, Barracks, Forts, Barriers, Wilderness, Mountain, Swamp, Glacier, Plain, Forest
    * @global  array $village matrix 
    * @author  Olav Bringedal <olav@jaggu.org>
    * @since   Tue Feb 23 2010 12:33:31 GMT+0100
    * @version v 0.00 Tue Feb 23 2010 12:33:31 GMT+0100
    * @todo    lots
    */
    placeLand ($startCoord, $move)
    {
    
    }
    
    
}